#pragma once

#include <stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#include<assert.h>

typedef int HPDataType;

typedef struct Heap
{
	HPDataType* a;
	int capacity;
	int size;
}HP;


void HeapInit(HP* hp);

void HeapPush(HP* hp, HPDataType x);

void HeapPop(HP* hp);

void AdjustDown(HPDataType* a, int n, int parent);

void AdjustUp(HPDataType* a, int n, int child);

void Swap(HPDataType* px, HPDataType* py);

void HeapDestroy(HP* hp);

void HeapPrint(HP* hp);

HPDataType HeapSize(HP* hp);

bool HeapEmpty(HP* hp);

void HeapSort(int* a, int n);



